//
//  AKPPersonEmptyView.m
//  Copy_AiKapPu_Personal_OC
//
//  Created by taojianz on 2017/7/12.
//  Copyright © 2017年 taojianz. All rights reserved.
//

#import "AKPPersonEmptyView.h"
#import <nbappdev/nbappdev.h>

@interface AKPPersonEmptyView()

@property (strong,nonatomic) UILabel *tipsLabel;
@property (strong,nonatomic) UIImageView *tipsImageView;


@end


@implementation AKPPersonEmptyView
-(instancetype)init{
    self = [super init];
    [self initSubViews];
    self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    return self;
}

-(void)initSubViews{
    self.tipsLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 122, 100, 22)];
    _tipsLabel.textAlignment = NSTextAlignmentCenter;
    _tipsLabel.textColor = UIColorFromrgb(153, 153, 153, 1);
    _tipsLabel.font = [UIFont systemFontOfSize:16];
    _tipsLabel.text = @"没有更多啦～";
    
    self.tipsImageView = [[UIImageView alloc] init];
    _tipsImageView.image = [UIImage imageNamed:@"没有数据"];
    
    [self addSubview:_tipsImageView];
    [self addSubview:_tipsLabel];
    
    _tipsLabel.translatesAutoresizingMaskIntoConstraints = NO;
    _tipsImageView.translatesAutoresizingMaskIntoConstraints = NO;
    
    // 设置ImageView的约束
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsImageView
                                                     attribute:NSLayoutAttributeCenterX
                                                     relatedBy:NSLayoutRelationEqual
                                                     toItem:self
                                                     attribute:NSLayoutAttributeCenterX
                                                     multiplier:1
                                                     constant:0]];
    
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsImageView
                                                     attribute:NSLayoutAttributeCenterY
                                                     relatedBy:NSLayoutRelationEqual
                                                     toItem:self
                                                     attribute:NSLayoutAttributeCenterY
                                                     multiplier:1
                                                     constant:-80]];
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsImageView
                                                     attribute:NSLayoutAttributeWidth
                                                     relatedBy:NSLayoutRelationEqual
                                                     toItem:nil
                                                     attribute:NSLayoutAttributeWidth
                                                     multiplier:1
                                                     constant:100]];
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsImageView
                                                     attribute:NSLayoutAttributeHeight
                                                     relatedBy:NSLayoutRelationEqual
                                                     toItem:nil
                                                     attribute:NSLayoutAttributeHeight
                                                     multiplier:1
                                                     constant:100]];
    
    // label约束
    
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsLabel
                                                     attribute:NSLayoutAttributeCenterX
                                                     relatedBy:NSLayoutRelationEqual
                                                        toItem:_tipsImageView
                                                     attribute:NSLayoutAttributeCenterX
                                                    multiplier:1
                                                      constant:0]];
    
    [self addConstraint:[NSLayoutConstraint constraintWithItem:_tipsLabel
                                                     attribute:NSLayoutAttributeTop
                                                     relatedBy:NSLayoutRelationEqual
                                                        toItem:_tipsImageView
                                                     attribute:NSLayoutAttributeBottom
                                                    multiplier:1
                                                      constant:8]];
}

@end
